import React from 'react';
import { Spin, SpinProps } from 'antd';

interface LoadingProps extends SpinProps {
  tip?: string;
  fullScreen?: boolean;
  minHeight?: number | string;
}

const Loading: React.FC<LoadingProps> = ({ 
  tip = '加载中...', 
  fullScreen = false, 
  minHeight = 200,
  ...props 
}) => {
  const style: React.CSSProperties = {
    display: 'flex',
    justifyContent: 'center',
    alignItems: 'center',
    minHeight: typeof minHeight === 'number' ? `${minHeight}px` : minHeight,
  };

  if (fullScreen) {
    style.position = 'fixed';
    style.top = 0;
    style.left = 0;
    style.right = 0;
    style.bottom = 0;
    style.backgroundColor = 'rgba(255, 255, 255, 0.8)';
    style.zIndex = 9999;
    style.minHeight = '100vh';
  }

  return (
    <div style={style}>
      <Spin tip={tip} size="large" {...props} />
    </div>
  );
};

export default Loading;
